﻿<%@ Page Title="Cungmuanao.com - Cập đơn hàng" Language="C#" MasterPageFile="~/Admin/Admin.master" 
    AutoEventWireup="true" ValidateRequest="false" CodeFile="AddEditOrder.aspx.cs" Inherits="AddEditOrder" %>
<%@ Import Namespace="DTO" %>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<script type="text/javascript" src="../js/nicEdit.js"></script>
<script type="text/javascript">
    bkLib.onDomLoaded(function () {
        nicEditors.allTextAreas()
    });
</script>

<div class="title">
  <asp:Literal runat="server" ID="lblEditOrder" Text="Cập nhật đơn hàng" />
</div>
<div class="body">  
<asp:DetailsView ID="dvwOrder" Width="100%" runat="server"  AutoGenerateRows="False" 
        DataKeyNames="ID" DataSourceID="objOrder"
        DefaultMode="Edit" BackColor="White"
        BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" 
        CellPadding="3" >
       <FieldHeaderStyle Width="100px" />
       <FooterStyle BackColor="White" ForeColor="#000066" />
       <RowStyle ForeColor="#000066" />
       <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
      <Fields>
         <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" />
         <asp:BoundField DataField="AddedDate" HeaderText="Ngày đặt hàng" InsertVisible="False"
            ReadOnly="True" SortExpression="AddedDate" HtmlEncode="false" DataFormatString="{0:f}" />
         <asp:BoundField DataField="ProductTitle" HeaderText="Sản phẩm" InsertVisible="False" ReadOnly="True" SortExpression="ProductTitle" />         
        <asp:ImageField HeaderText="Hình" DataImageUrlField="SmallImageUrl" ReadOnly="True"/>                          
        <asp:BoundField HeaderText="Họ tên" DataField="ShippingFirstName" ReadOnly="True" SortExpression="ShippingFirstName" />         
        <asp:BoundField HeaderText="Điện thoại" DataField="customerPhone" ReadOnly="True" SortExpression="customerPhone" />
        <asp:BoundField HeaderText="Email" DataField="customerEmail" ReadOnly="True" SortExpression="customerEmail" />

        <asp:TemplateField HeaderText="Tình trạng">
            <ItemTemplate>
                <asp:Label runat="server" ID="lblStatus" Text='<%#Eval("StatusID") %>' />
            </ItemTemplate>        
            <EditItemTemplate>
            <asp:DropDownList runat="server" ID="ddlPartnerCat" Width="200px"
                SelectedValue='<%# Bind("StatusID") %>'>
                    <asp:ListItem Text="Đơn hàng mới" Value="1"></asp:ListItem>
                    <asp:ListItem Text="Đơn hàng đã thanh toán" Value="2"></asp:ListItem>
                    <asp:ListItem Text="Đơn hàng hủy" Value="3"></asp:ListItem>
            </asp:DropDownList>                   
            </EditItemTemplate>
        </asp:TemplateField>

        <asp:CommandField ButtonType="Image" CancelImageUrl="~/Images/nhaplai.png" 
              CancelText="Nhập  lại" InsertImageUrl="~/Images/themmoi.png"  ShowCancelButton="false"
              InsertText="Thêm mới" ShowInsertButton="True" ShowEditButton="True"
              UpdateImageUrl="~/Images/capnhat.png" UpdateText="Cập nhật" />         
        </Fields>
</asp:DetailsView>

<asp:ObjectDataSource runat="server" ID="objOrder" TypeName="BLL.Store.Order" 
    SelectMethod="GetOrderByID" UpdateMethod="UpdateOrder" OnUpdated="objOrder_OnUpdated">
    <SelectParameters>
        <asp:QueryStringParameter Name="OrderID" QueryStringField="ID" Type="Int32" />
    </SelectParameters>
    <UpdateParameters>
         <asp:Parameter Name="id" Type="Int32" />
         <asp:Parameter Name="StatusID" Type="Int32" />
    </UpdateParameters>
    </asp:ObjectDataSource>
</div>   
<div class="bottom"></div>
</asp:Content>

